import { Composite } from "../core/Composite";
import { ActionStatus } from "../core/BaseNode";
import { Tick } from "../core/Tick";

export class Sequence extends Composite {
    constructor(params?: any) {
        super(params);
        this.name = 'Sequence';
    }
    tick(tick: Tick) : ActionStatus {
        for (let i = 0; i < this.children.length; i++) {
            let status = this.children[i]._execute(tick);
            if (status !== ActionStatus.SUCCESS) {
                return status;
            }
        }
        return ActionStatus.SUCCESS;
    }
}